package com.shop.page.service;




import com.shop.common.pojo.RD;
import com.shop.common.pojo.SpManager;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@FeignClient(name = "shop-service-user",fallback = UserFeignFallBack.class)
public interface UserFeign {

    /**
     * 通过id获取商品信息
     * @param id
     * @return
     */
    @RequestMapping("/query/{id}")
    public SpManager query(@PathVariable Integer id);

    /**
     * 获得端口号
     * @return
     */
    @RequestMapping("/query")
    public String findServerPort();
    /**
     * 查全部
     * @return
     */
    @GetMapping("/users")
    public RD findAll(@RequestParam(value = "query",defaultValue = "") String query, @RequestParam(value = "pagenum",defaultValue = "1") int pagenum, @RequestParam(value = "pagesize",defaultValue = "2") int pagesize);
    @PostMapping("/users")
    public RD addUser(SpManager spManager);
    @PutMapping("/users/{uId}/state/{type}")
    public RD updateUserState(@PathVariable int uId,@PathVariable int type);
    @GetMapping("/users/{id}")
    public RD selectUserById(@PathVariable int id);
    @PutMapping("/users/{id}")
    public RD updateUser(@PathVariable int id,@RequestBody SpManager spManager);

    @DeleteMapping("/users/{id}")
    public RD deleteUser(@PathVariable int id);

}